package com.xiongwei.observer;

/**
 * 气象站将测量数据（温度，湿度，气压）等发布公告
 * 提供api便于第三方获取数据
 * 数据更新时，实时通知第三方
 * @author XiongWei
 * @date 2024/2/1
 */
public class Client {

    public static void main(String[] args) {
        Observer sinaWeather = new SinaWeather();
        TencentWeather tencentWeather = new TencentWeather();

        //注册观察者
        WeatherData weatherData = new WeatherData();
        weatherData.registerObserver(sinaWeather);
        weatherData.registerObserver(tencentWeather);

        System.out.println("通知已注册的观察者");
        weatherData.setData(10, 100, 30.3f);

        weatherData.setData(11, 101, 31.3f);

    }

}
